package com.dongdongshop.service.imp;

import com.alibaba.dubbo.config.annotation.Service;
import com.dongdongshop.mapper.TbContentCategoryMapper;
import com.dongdongshop.pojo.TbContentCategory;
import com.dongdongshop.service.CategoryService;
import org.springframework.data.redis.core.RedisTemplate;

import javax.annotation.Resource;
import java.util.List;

@Service
@org.springframework.stereotype.Service
public class CategoryServiceImp implements CategoryService {
    @Resource
    private TbContentCategoryMapper categoryMapper;
    @Resource
    private RedisTemplate redisTemplate;
    @Override
    public List<TbContentCategory> getCategory(String name) {
            List<TbContentCategory> categoryList = categoryMapper.selectByCategory(name);
            return categoryList;

    }

    @Override
    public int addInfoCategroy(TbContentCategory tbContentCategory) {
        return categoryMapper.insertSelective(tbContentCategory);
    }

    @Override
    public int deleteInfo(Long[] ids) {
        return categoryMapper.deleteInfo(ids);
    }

    @Override
    public TbContentCategory toUpdate(Long id) {
        return categoryMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateInfo(TbContentCategory category) {
        return categoryMapper.updateByPrimaryKeySelective(category);
    }

    @Override
    public List<TbContentCategory> selectAll() {
        return categoryMapper.selectByExample(null);
    }

}
